import org.apache.spark.internal.Logging

import java.util.Properties

object Demo001 {
  private case class DeprecatedConfig(
                                       key: String,
                                       version: String,
                                       deprecationMessage: String)


  private object DemoBuildInfo {
    var (
      a: String,
      b: String,
      c: String,
      d: String) = {
      val props = new Properties()
      (
        props.getProperty("a", "1"),
        props.getProperty("b", "2"),
        props.getProperty("c", "3"),
        props.getProperty("d", "4")
      )


    }

//    val (a, b, c) = ("a", "b", "c")

  }


  def main(args: Array[String]): Unit = {
    val a = DemoBuildInfo.a
    val configs = Seq(DeprecatedConfig("", "", ""), DeprecatedConfig("1", "", ""), DeprecatedConfig("2", "", ""))

    val tuples = configs.map {
      x => (x.key, x)
    }

    val stringToConfig1 = Map(tuples: _*)


    val stringToConfig = Map(configs.map { cfg => (cfg.key -> cfg) }: _*)


    val demoTrait = new DemoTrait()

    val name = demoTrait.logName
    println(name)

    logInfo({
      "2"
    })


    method1({
      println("Evaluate Arg1");
      "Method1"
    })
    method2({
      println("Evaluate Arg2");
      "Method2"
    })

  }


  // msg: => String   和 msg:String
  // 一个延迟执行,一个立即执行

  protected def logInfo(msg: => String): Unit = {
    println(msg)
  }


  def method1(msg: => String) = {
    println(msg)
    println(msg)
  }

  def method2(msg: String) = {
    println(msg)
    println(msg)
  }


}
